package com.common.retrofit.methods;

import com.common.carbean.OrderIdBean;
import com.common.cons.Constans;
import com.common.retrofit.base.BaseMethods;
import com.common.retrofit.service.HaiNingService;
import com.common.utils.SortUtils;

import rx.Observable;
import rx.Subscriber;

public class GoOrderMethods extends BaseMethods {

    private static GoOrderMethods m_ins = null;

    public static GoOrderMethods getInstance() {
        if (m_ins == null) {
            synchronized (GoOrderMethods.class) {
                if (m_ins == null) {
                    m_ins = new GoOrderMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
        return "Api/Order/";
    }

    private HaiNingService initService() {
        return getRetrofit().create(HaiNingService.class);
    }


    public void     addOrder (Subscriber<OrderIdBean> subscriber,
                      int uid , String hashid ,String address,int carid,String say,String longitude,String latitude,int is_now,String sub_time ,String total,String city ) {
        Observable observable = initService().addOrder(System.currentTimeMillis()+"",
                SortUtils.getMyHash("uid","hashid"
                        ,"address"
                        ,"carid"
                        ,"say"
                        ,"longitude"
                        ,"latitude"
                        ,"is_now"
                        ,"sub_time"
                        ,"total"
                        ,"city"

                ), Constans.ANDROID_APP_ID,"3",uid,hashid,address,carid,say,longitude,latitude,is_now,sub_time ,total,city
        );
        toSubscribe(observable, subscriber);
    }
}
